#!usr/bin/env python
# -*- coding:utf-8 _*-
"""
@author:zhengxin
@file: 008_algorithm.py
@time: 2024/12/16  11:29
# @describe:
"""

"""
题目008：题目：输出 9*9 乘法口诀表。

"""
# 方式一
def tm008():
    for i in range(1, 10):
        for j in range(1, 10):
            if j<=i:
                string = "%d*%d=%d" %(j, i, j*i)
                # 指定了左对齐且宽度为7的字符串格式； 打印后不换行
                print("%-7s" %string, end='')
        print('')

tm008()



# 方式二
def tm008_1():
    for i in range(1, 10):
        for j in range(1, i+1):
            print("{0} * {1} = {2}".format(i, j, i*j), end="\t")
        print()

tm008_1()

